package day03;

import java.util.Set;

public class Person implements Comparable<Person> {

    private int ID;
    private int age;
    private String name;
    private Set<Card> cardList;
    private Card maxCard;

    public Card getMaxCard() {
        return maxCard;
    }

    public void setMaxCard(Card maxCard) {
        this.maxCard = maxCard;
    }

    public int getID() {
        return ID;
    }

    public void setID(int ID) {
        this.ID = ID;
    }

    public Set<Card> getCardList() {
        return cardList;
    }

    public void setCardList(Set<Card> cardList) {
        this.cardList = cardList;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Person() {
    }

    public Person(int ID, int age, String name) {
        this.ID = ID;
        this.age = age;
        this.name = name;
    }

    @Override
    public int compareTo(Person person) {
        Card card = person.getMaxCard();
        if (card.getPoint() > maxCard.getPoint()) {
            return 1;
        } else if (card.getPoint() == maxCard.getPoint()) {
            if (card.getWeight() > maxCard.getWeight()) {
                return 1;
            }
            return -1;
        }
        return -1;
    };

    @Override
    public String toString() {
        return "pocker.Person{" +
                "ID=" + ID +
                ", age=" + age +
                ", name='" + name + '\'' +
                '}';
    }
}
